package com.rui.shiliao;

import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class PhotoAdapter extends ArrayAdapter<Bitmap>
{
  private Context context;
  private List<Bitmap> objects;

  public PhotoAdapter(Context paramContext, int paramInt, List<Bitmap> paramList)
  {
    super(paramContext, paramInt, paramList);
    this.context = paramContext;
    this.objects = paramList;
  }

  public int getCount()
  {
    return this.objects.size();
  }

  public Bitmap getItem(int paramInt)
  {
    return (Bitmap)this.objects.get(paramInt);
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    ImageView localImageView = new ImageView(this.context);
    localImageView.setImageBitmap(getItem(paramInt));
    localImageView.setPadding(5, 5, 5, 5);
    LinearLayout localLinearLayout = new LinearLayout(this.context);
    LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-2, -2);
    localLayoutParams.setMargins(5, 5, 5, 5);
    localLinearLayout.setPadding(5, 5, 5, 5);
    localLinearLayout.addView(localImageView, localLayoutParams);
    return localLinearLayout;
  }
}